import java.util.HashMap;
import java.util.Map;

public class CharacterFactory {
    private static Map<String, Character> pool = new HashMap<>();

    public static Character getCharacter(String charValue, String font, int size) {
        String key = charValue + font + size; // 唯一标识内部状态
        if (!pool.containsKey(key)) {
            pool.put(key, new ConcreteCharacter(charValue, font, size));
        }
        return pool.get(key);
    }
}
